﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls.UI;
using APC.Common; //Database Handling - UI Language - Icon Gallery

namespace APC
{
    public partial class frmOrderPriority : Form
    {
        private IconLibrary ImageList;

        public frmOrderPriority()
        {
            InitializeComponent();

            ImageList = new IconLibrary();
        }

        private void frmOrderPriority_Load(object sender, EventArgs e)
        {
            Order o = new Order(true);

            foreach (APC.Common.Order or in o.PendingOrderList)
            {
                ListViewDataItem lst = new ListViewDataItem();
                lst.Tag = or.Id;
                lst.Image = SetIcon("order");
                lst.SubItems.Add(""); //Icon
                lst.SubItems.Add(or.OrderNumber);
                lst.SubItems.Add(or.Name);

                lstOrderPriority.Items.Add(lst);
            }
        }

        /// <summary>
        /// Returns icon based on icon name. E.g."folder"
        /// </summary>
        /// <param name="MenuIcon"></param>
        /// <returns></returns>
        private Image SetIcon(String MenuIcon = "")
        {
            int i;
            Image img = null;

            i = ImageList.Img16x16.Images.IndexOfKey(MenuIcon.Trim());

            if (i > -1)
            {
                img = ImageList.Img16x16.Images[i];
            }
            return img;
        }

        private void btnCancelOrderPriority_Click(object sender, EventArgs e)
        {

        }

    }
}
